Running MCSED

MCSED calculates the log-likelihood of a solution as

\[\log L = -{1 \over 2} \sum_{i=1}^N \left[ \ln \left( w_i \sigma_i^2 \right) + { w_i \left( x_i - \mu_i \right)^2 \over \sigma_i^2} \right]\]

where \(\mu_i\) are the modeled quantities, \(x_i\) are the observed quantities, \(\sigma_i\) are the uncertainties, and \(w_i\) are the weights. By default, \(w_i \equiv 1\) for all photometric points, while emission lines and absorption line indices can have user-defined weights (as described in Input Files). The \(\sigma_i\) terms include contributions from the uncertainties associated with both the observations and the models. As pointed out in Required Columns, the observed uncertainties may be based on the errors given in the input file or the minimum fractional uncertainties defined by phot_floor_error, emline_floor_error, and absorption_floor_error. In addition, the \(\sigma_i\) values include a term associated with the uncertainties of the models themselves. This fractional error is defined in the file config.py via the model_floor_error keyword and is given the default value of \(\sigma_{m,frac} = 0.1\). The final \(\sigma_i^2\) term is calculated as

\[\sigma_i^2 = \sigma_{i,obs}^2 + \left( \mu_i \sigma_{m,frac} \right)^2\]

MCSED can be run in two different modes: a live mode, where SED fits are performed on a set of galaxies defined in an input file, and a test mode, where MCSED is run on mock galaxies with known parameters. Both of these modes can take advantage of the parallel feature, which utilizes multiple cores. We describe these modes below.

Live Mode

Live mode is the most common method of running MCSED. In this mode, MCSED will take an input file (as described in Input Files) and fit each object, producing the outputs described in Outputs. To run MCSED in live mode, issue

python run_mcsed_fit.py -f <input_file>

with any of the additional parameters described above. (Use the -h option to see the complete list.) While running MCSED, a table will appear onscreen as it is being built, as well as the mean acceptance fraction, auto correlation steps, and number of burn-in steps for each object.

Test Mode

Test mode allows the user to explore how well MCSED can recover model parameters under realistic observing conditions. In this mode, MCSED will construct a mock galaxy SED, simulate photometric observations of the galaxy, and fit a model to the simulated photometry.

To run MCSED in test mode, use the -t option on the command line:

python run_mcsed_fit.py -t

This mode was developed to be used with the Skelton et al. (2014) photometric catalog (and is currently a photometry-only mode). The test field is specified by including the (optional) -tf FIELD option in the above command line call, where FIELD can be one of aegis, cosmos, goodsn, goodss, or uds (the default is cosmos). The photometric filters and corresponding photometric errors are the filter set associated with the selected CANDELS field.

The mock SED is realized from a set of “truth” model parameters (corresponding to the parameter classes defined in config.py or specified on the command line) and randomly drawn from the prior distributions. The redshift of the mock galaxy is randomly drawn from a uniform distribution spanning the range of redshifts specified by the test_zrange keyword in config.py (the default range is \(1 < z < 2\)). Photometric data for the mock galaxy are then simulated by measuring the filter flux densities from the mock SED and perturbing those fluxes about their associated photometric uncertainties. Finally, these mock observations are used to fit an SED model and estimate the corresponding model parameters. Upon completion, MCSED will return the calculated parameters from the run, as well as the “truth” model parameters, filter fluxes, and SED.

Users are able to apply test mode to different surveys by defining two dictionaries in filter_info.py. For a new test field test_field, a catalog_filter_dict['test_field'] and catalog_maglim_dict['test_field'] need to be defined. In the filter dictionary, the keys are integers with the corresponding value being the name of a filter .res file (without the .res extension). In the maglim dictionary, the values are the 5-\(\sigma\) survey depths in magnitudes. The magnitude limit value will be used to generate the uncertainties for the synthetic photometry generated.

Parallel Mode

Parallel mode will automatically utilize \(N-i\) cores on a multiprocessor system, where \(N\) is the total number of cores on the machine and \(i\) is the number of cores that will not be used in the calculation. The number of reserved cores can be specified by the user in config.py using the reserved_cores keyword. This mode is extremely useful for fitting large samples of galaxies.

To run MCSED in parallel mode, include the -p option on the command line, e.g.,

python run_mcsed_fit.py -f <input_file> -p

along with any other desired command line options. Parallel mode can be used with either live mode (as above) or test mode.